import Cache from '../../common/cache.js'

export default {
	namespaced: true,
	state: {
		uploadAvatarTip: null,
		userInfo: {}
	},
	mutations: {
		setUserInfo(state, userInfo) {
			state.userInfo = userInfo
		},
		setUploadAvatarTip(state, yesOrNo) {
			state.uploadAvatarTip = yesOrNo
			Cache.put('uploadAvatarTip', yesOrNo)
		},
	},
	getters: {
		uploadAvatarTip(state) {
			if (state.uploadAvatarTip === null) {
				state.uploadAvatarTip = Cache.get('uploadAvatarTip')
			}
			return state.uploadAvatarTip
		},
	}
}
